package com.joysuch.wwyt.mh.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.joysuch.wwyt.mh.bean.MhAlarmLimitConfigBean;
import com.joysuch.wwyt.mh.entity.MhAlarmLimitConfig;
import com.joysuch.wwyt.mh.enums.AlarmLimitTypeEnum;
import com.joysuch.wwyt.mh.mapper.MhAlarmLimitConfigMapper;
import com.joysuch.wwyt.mh.service.MhAlarmLimitConfigService;
import org.springframework.stereotype.Service;

/**
 * @author Leong
 * @date 2022/9/19 16:23
 */
@Service
public class MhAlarmLimitConfigServiceImpl extends ServiceImpl<MhAlarmLimitConfigMapper, MhAlarmLimitConfig> implements MhAlarmLimitConfigService {

    @Override
    public MhAlarmLimitConfig findOneConfig(Long tenentId, String orgCode) {
        return baseMapper.findOneConfig(tenentId,orgCode);
    }

    @Override
    public void updateLimit(MhAlarmLimitConfigBean bean) {
        MhAlarmLimitConfig config = baseMapper.selectById(bean.getId());
        if (config != null){
            config.setExceedTimes(bean.getExceedTimes());
            config.setPeriodUnit(bean.getPeriodUnit());
            config.setCheckRateDescribe(bean.getCheckRateDescribe());
            baseMapper.updateById(config);
        }
    }
}
